<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../common/taglibs.jsp" %>

<!DOCTYPE html>
<html lang="cn">
<head>
<title>银行信息</title>
<%@ include file="../common/jqGridScript.jsp" %>
<script type="text/javascript">
$( function() {

	var url = '${ctx }/demo/bank.action';

	init();

	function init() {
		url += '?pageable.size=10&pageable.page=1';
		var properties = [ 'code', 'name', 'asset', 'remark', 'createTime'];
		var $grid = $( '#list' );
		$grid.empty();
		var elContent = '<th>编号</th><th>名称</th><th>资产</th><th>备注</th><th>创建日期</th>';
		var el = '<thead><tr>' + elContent + '</tr></thead>';
		var value = null;

		$.getJSON( url, function( json ) {
			var elBody = '';
			$( json.content ).each( function() {
				elBody += '<tr>';
				for( var i = 0; i < properties.length; i++ ) {
					value = this[ properties[ i ] ]
					if( null == value || undefined == value ) {
						value = '';
					}
					elBody += '<td>';
					elBody += value;
					elBody += '</td>';
				}
				elBody += '</tr>';
			} );
			$grid.append( el + '<tbody>' + elBody + '</tbody>' );
		} );
	}

	/** 查询. */
	$( '#queryBtn' ).click( function() {
		$( '#list' ).jqGrid( 'setGridParam', {
			url: url,
			page: 1,
			datatype: 'json',
			postData: $.getGridParams( '#frm', '#list' )
		} ).trigger( 'reloadGrid' );
	} );

	/** 修改. */
	$( '#modifyBtn' ).click( function() {
		var dataId = $( '#list' ).jqGrid( 'getGridParam', 'selrow' );
		if( null != dataId ) {
			window.location.href = '${ctx }/demo/bank!input.action?id=' + dataId;
		}
	} );

} );
</script>
</head>

<body>
	<ul class="breadcrumb">
	  <li>银行信息<span class="divider">/</span></li>
	  <li class="active">查询</li>
	</ul>

	<form id="frm" method="post">
<!-- 		<div class="controls controls-row"> -->
			<input type="button" id="queryBtn" class="btn btn-primary" value="查询" />
			<input type="button" id="modifyBtn" class="btn btn-primary" value="修改" />
<!-- 		</div> -->
	</form>

	<table id="list" class="table table-striped table-hover"></table>
	<div class="row-fluid">
		<ul class="pager">
			<li><a href="#">前一页</a></li>
			<li><a href="#">后一页</a></li>
		</ul>
		<div class="span3 offset3">...</div>
	</div>
</body>
</html>